<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>告警监控</title>
  <th:block th:include="common/pub_head :: default"></th:block>
  <th:block th:include="common/pub_head :: layui"></th:block>

</head>
<body class="container" style="padding: 4px 5px">
<blockquote class="layui-elem-quote layui-text">
  监控主机基本信息
</blockquote>
<form class="layui-form layui-form-pane" id="list_form" style="width: 800px;margin: 0 auto">
  <input type="hidden" name="id" th:value="${pcBean.id}" />
  <div class="layui-form-item">
    <div class="layui-inline">
      <label class="layui-form-label">IP</label>
      <label class="layui-form-label" style="width: 190px"
        th:text="${pcBean.ip}"></label>
    </div>
    <div class="layui-inline">
      <label class="layui-form-label">MAC地址</label>
      <label class="layui-form-label" style="width: 190px"
        th:text="${pcBean.mac}"></label>
    </div>
    <div class="layui-inline">
      <a  lay-submit="" lay-filter="save" class="layui-btn layui-btn-sm">保存</a>
    </div>
  </div>
  <div class="layui-form-item">
      <label class="layui-form-label">地址<span class="f-red">*</span></label>
      <div class="layui-input-block" style="width: 505px">
        <input type="text" placeholder="请输入地址" name="address"
               th:value="${pcBean.address}" lay-verify="required"
               autocomplete="off" class="layui-input">
      </div>
  </div>
  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">备注<span class="f-red">*</span></label>
    <div class="layui-input-block">
      <textarea placeholder="请输入备注"
                th:text="${pcBean.remark}" name="remark"
                lay-verify="required" class="layui-textarea"></textarea>
    </div>
  </div>
</form>
<script>
  var form;
  layui.use(['table', 'form'], function () {
    form = layui.form;

    form.on("submit(save)", function(data) {
      savePc();
    });

    function savePc() {
      var URL = path + "/savePc";
      var formData = $("#list_form").serializeArray();

      var load = layer.load();
      $.post(URL, formData, function(jsonData) {
        layer.close(load);
        if (jsonData.flag) {
          layer.msg("保存成功", {icon: 1});
        } else {
          layer.msg("保存失败，失败原因：" + jsonData.errorMsg, {icon: 2});
        }
      }, "json");
    }
  });
</script>
</body>
</html>